package models

import "gorm.io/gorm"

type User struct {
	gorm.Model
	Mobile     string
	Password   string
	MemberData string `gorm:"type:date"`
	Status     string
}

func (u *User) GetUserByMobile() error {
	return DB.Where("mobile = ?", u.Mobile).Limit(1).Find(u).Error
}

func (u *User) Register() error {
	return DB.Create(&u).Error
}

func (u *User) GetUserById() error {
	return DB.Where("user_id = ?", u.ID).Limit(1).Find(u).Error
}
